package com.example.cloud.model.member;

import com.example.cloud.model.business.reservation.Patient;
import com.example.cloud.model.common.CommonModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
import javax.persistence.Version;
import java.math.BigDecimal;

/**
 * Created by wangtao on 2018/7/30.
 * 会员资料
 */
@Entity(name = "member")
@Data
@EqualsAndHashCode(callSuper = false)
public class Member extends CommonModel {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    // 患者主键
    @Column(name = "patient_id")
    private Long patientId;
    // 患者姓名
    @Column(name = "patient_name")
    private String patientName;
    // 会员编号
    @Column(name = "member_number")
    private String memberNumber;
    // 会员姓名
    @Column(name = "member_name")
    private String memberName;
    // 会员等级
    @Column(name = "level_id")
    private Long levelId;
    // 会员等级名称
    @Column(name = "level_name")
    private String levelName;
    // 会员星级
    @Column(name = "star")
    private int star;
    // 会员手机号码
    @Column(name = "phone")
    private String phone;
    // 信誉分
    @Column(name = "score")
    private int score;
    // 储值账户
    @Column(name = "store_account", columnDefinition = "decimal default 0.0", precision = 12, scale = 2)
    private BigDecimal storeAccount = BigDecimal.ZERO;
    // 疗程账户
    @Column(name = "course_account", columnDefinition = "decimal default 0.0", precision = 12, scale = 2)
    private BigDecimal courseAccount = BigDecimal.ZERO;
    // 赠送账户
    @Column(name = "gift_account", columnDefinition = "decimal default 0.0", precision = 12, scale = 2)
    private BigDecimal giftAccount = BigDecimal.ZERO;
    // 会员累计金额
    @Column(name = "member_amount", columnDefinition = "decimal default 0.0", precision = 12, scale = 2)
    private BigDecimal memberAmount = BigDecimal.ZERO;
    // 累计充值金额
    @Column(name = "total_store_amount", columnDefinition = "decimal default 0.0", precision = 12, scale = 2)
    private BigDecimal totalStoreAmount = BigDecimal.ZERO;
    // 累计赠送金额
    @Column(name = "total_gift_amount", columnDefinition = "decimal default 0.0", precision = 12, scale = 2)
    private BigDecimal totalGiftAmount = BigDecimal.ZERO;
    // 累计消费金额
    @Column(name = "total_consume_amount", columnDefinition = "decimal default 0.0", precision = 12, scale = 2)
    private BigDecimal totalConsumeAmount = BigDecimal.ZERO;
    // 会员状态{0：激活 1：冻结}
    @Column(name = "status", columnDefinition = "INT DEFAULT 0")
    private int status;
    // 账户
    @Column(name = "account_id")
    private Long accountId;
    // 用户
    @Column(name = "user_id")
    private Long userId;
    // 组织机构编号
    @Column(name = "organ_id")
    private Long organId;
    // 组织机构名称
    @Column(name = "organ_name")
    private String organName;
    @Version
    @Column(name = "version")
    private Integer version;
    @Transient
    private Patient patient;
}
